package com.base.date;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Date 日期类的使用
 *
 * @author innocent
 * @date 2019/1/18 9:56
 */
public class DateDemo {

    public static void main(String[] args) {
        Date date = new Date();
        System.out.println("date.getTime() = " + date.getTime());

        String later = "2019-01-20 09:30:33";
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date lateDate = null;
        try {
            lateDate = format.parse(later);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        System.out.println("lateDate = " + lateDate);

        boolean before = date.before(lateDate);
        System.out.println("before = " + before);
    }

}
